//
// CImageGrabberFilter.h
//

#ifndef __H_CImageGrabberFilter__
#define __H_CImageGrabberFilter__

#include "CDXFilter.h"
#include "IImageGrabber.h"

class CImageGrabberFilter : public CDXFilter  
{
private:
	IImageGrabber *	mIGrabber;

public:
	CImageGrabberFilter(IGraphBuilder * inGraph);
	virtual ~CImageGrabberFilter(void);

	virtual BOOL CreateFilter(void);
	virtual void ReleaseFilter(void);

	BOOL GetImageSize(long * outWidth, long * outHeight, long * outBitCount);
	BOOL GetFrameSize(long * outFrameSize);
	BOOL GetBitmapInfoHeader(BITMAPINFOHEADER * outBitmapInfo);
	BOOL Is16BitsRGB(long * outIsRGB565);
	BOOL SetFieldPicture(BOOL inIsField);
	BOOL Snapshot(BYTE * outBuffer, BOOL inIsSyncMode);
	BOOL IsAsyncSnapshotFinished(void);
	BOOL CancelAllPending(void);

	// Demo: how to use these interface methods?
	BOOL SnapshotToFile(const char * inFile);

private:
	void WriteImageFile(BYTE * inData, long inSize, const char * inFile);
};

#endif // __H_CImageGrabberFilter__
